MCI Commands


 

MCIObject("ObjectLabel","Command")
Description
 


Sends a command to MCI Object.

The possible commands are:

    Play

    Pause

    Stop

    Close

Code Example
 

** Start playing MCI object
MCIObject("MCI_Object","Play")

** Pause MCI object playback
MCIObject("MCI_Object","Play")

 

MCICommand("MCIString")
Description
 


This will send a string to a device. The string will tell the device what to do.
With this command you can access the devices for playing MPEG, video discs, record sound, play animation etc..
You can use <SrcDir>, <SrcDrive> or <CD> in the string.
Also use <This> with the parent command to tell the device the MMB window will be the parent.

For detailed information about the possible MCI strings, please, refer to the Mcistr.hlp documentation included in MMB root folder.

Code Example
 

Example: Here is a small sample to play MPG movie inside the mbd project in the position (100,50,100,100):

    MCICommand("open <SrcDir>\sample.mpg alias MPEG style child parent <This>")

    MCICommand("put MPEG window at 100 50 200 200")

    MCICommand("window MPEG state hide")

    MCICommand("play MPEG")

Example:(Open and close door on CD (beer holder))

    MCICommand("set cdaudio door open")

    MCICommand("set cdaudio door closed"

     

Some of the MCICommand functions can return a value (for example number of tracks on CD)
The variable MCIResult will have the result (integer) number.

 

Example: (returns number of tracks on CD)

    MCICommand("status cdaudio number of tracks")

    DisplayValue("Text","MCIResult")

     

Example2: (returns length (in seconds) of track 1)

    MCICommand("status cdaudio length track 1")

    DisplayValue("Text_totalsec","MCIResult")

     

Example3: (returns status of CD audio)

MCICommand("status cdaudio mode")

If (MCIResult=-2) Then

     Show("Playing")

End

 

If (MCIResult=-1) Then

     Show("Stopped")

End

For a complete understanding and the syntax, consult Microsoft Documentation or Mcistr.hlp already installed in MMB folder.

WARNING! MCICommand accessing the device directly รป be prepare for crashing if you are going to experiment!

NOTE: MCI device has a path-length limit of 128 characters! If your media files are buried inside the nested subfolders and the path is longer than 128 characters, your media won't play.

Also, if the path has some spaces inside, don't forget to enclose the path inside the double quotes like in this example...

file$='<SrcDir>\sample.mpg'
open$='open "' + file$ + '" alias MPEG style child parent <This>' MCICommand("open$")

 

 

MMB Scripting Unleashed by Bokzy, 2003 :: All rights reserved :: http://www.bokzy.com